
// Ahmad Salama & Amine Allaouchiche
//

#include "nodedata.h"
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

struct TableType { 
	bool visited;          // whether node has been visited 
	int dist;              // shortest distance from source known so far 
	int path;              // previous node in path of min dist 
}; 

class GraphM
{                             
	public:

		//Constructor:---------------------------------------------------------
		GraphM();		

		//Destructor:----------------------------------------------------------
		~GraphM();

		//buildGraph:----------------------------------------------------------
		void buildGraph(ifstream&);		

		//findShortestPath(): Overloaded---------------------------------------
		void findShortestPath();

		//findShortestPath(int):-----------------------------------------------
		void findShortestPath(int);		

		//displayAll():--------------------------------------------------------
		void displayAll();

		//display(int, int): --------------------------------------------------
		void display(int, int);

		//insertEdge:----------------------------------------------------------
		const bool insertEdge(const int, const int , const int);

		//removeEdge:----------------------------------------------------------
		const bool removeEdge(const int, const int);


	private: 

		//Data Members:		
		NodeData* data;				// data for graph nodes information 
		int** C;              // Cost array, the adjacency matrix 
		int size;								// number of nodes in the graph 
		TableType** T;       // stores visited, distance, path 

		//Helper Methods:

		//findShortest:--------------------------------------------------------
		int findShortest(const int , int&);	

		//displayHelper:-------------------------------------------------------
		void displayHelper(int v, int k);		

		//isOk:----------------------------------------------------------------
		const bool isOk(const int);		

		//calMin:--------------------------------------------------------------
		int calMin(int, int);

		//calMin:--------------------------------------------------------------
		int calMin(int, int, bool&);		
};
